import { ApiProperty } from '@nestjs/swagger';
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
import { Exclude, Expose, Transform } from 'class-transformer';

export class Base {
    @Exclude()
    @PrimaryGeneratedColumn({ comment: '索引ID' })
    id: number;

    @Column({
        name: 'create_time',
        type: 'timestamp',
        default: () => 'CURRENT_TIMESTAMP',
        comment: '创建时间',
    })
    createTime: Date;

    @Column({
        name: 'update_time',
        type: 'timestamp',
        default: () => 'CURRENT_TIMESTAMP',
        comment: '更新时间',
    })
    updateTime: Date;

    @Exclude()
    @Column({ default: false, comment: '逻辑删除', })
    delete: boolean;

    // 组装属性
    // @Expose()
    // get description(): string {
    //     return `id=${this.id} 删除状态${this.delete}`;
    // }
}